//
// Created by baoch on 2024/12/18.
//
#include <stdio.h>
#include<stdlib.h>
struct DIAN//定义一个结构体类型
{
    int data;
    struct DIAN* next;
};
struct DIAN* HEAD()//申请头节点
{
    struct DIAN* head = (struct DIAN*)malloc(sizeof(struct DIAN));
    head -> data = 0;
    head -> next = NULL;
    return head;
}
int main()
{
    int n,x;
    scanf("%d %d",&n,&x);
    int arr[n];
    for(int i = 0;i < n;i++)//循环输入数组
    {
        scanf("%d ",&arr[i]);
    }
    struct DIAN* head = HEAD();
    struct DIAN* p = head;
    for(int i = 0;i < n;i++)//连接形成链表
    {
        struct DIAN* new = (struct DIAN*)malloc(sizeof(struct DIAN));
        new -> data = arr[i];
        new -> next = NULL;
        p -> next = new;
        p = p -> next;
    }
    p = head;
    struct DIAN* p2 = head -> next;
    while(p2 != NULL)//删除节点
    {
        if((p2 -> data) == x)
        {
            p -> next = p2 -> next;
            p2 = p2 -> next;
        }
        else
        {
            p = p -> next;
            p2 = p2 -> next;
        }
    }
    p = head -> next;
    while(p != NULL)//遍历链表打印数据
    {
        printf("%d ",p -> data);
        p = p -> next;
    }
    return 0;
}